//
//  PBComfirmPayTypeCell.m
//  PBHomeDemo
//
//  Created by Playboy on 2018/1/24.
//  Copyright © 2018年 tmkj. All rights reserved.
//

#import "PBComfirmPayTypeCell.h"

@interface PBComfirmPayTypeCell ()

@property (strong, nonatomic) IBOutlet UIView *alipayView;
@property (strong, nonatomic) IBOutlet UIView *weichatView;
@property (strong, nonatomic) IBOutlet UIImageView *alipayImageView;
@property (strong, nonatomic) IBOutlet UIImageView *weichatImageView;


@end

@implementation PBComfirmPayTypeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configure];
}

- (void)configure {
    UITapGestureRecognizer *alipayTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(alipayMethod)];
    [self.alipayView addGestureRecognizer:alipayTap];
    UITapGestureRecognizer *weichatTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(weichatMethod)];
    [self.weichatView addGestureRecognizer:weichatTap];
}
- (void)alipayMethod {
    if ([self.weichatImageView.image isEqual:[UIImage imageNamed:@"single_checked"]]){
        self.weichatImageView.image = [UIImage imageNamed:@"single_check"];
    }
    if ([self.alipayImageView.image isEqual:[UIImage imageNamed:@"single_check"]]) {
        self.alipayImageView.image = [UIImage imageNamed:@"single_checked"];
    }
    if (self.delegate && [self.delegate respondsToSelector:@selector(chooseTheType:)]) {
        [self.delegate chooseTheType:2];
    }
}
- (void)weichatMethod {
    if ([self.alipayImageView.image isEqual:[UIImage imageNamed:@"single_checked"]]){
        self.alipayImageView.image = [UIImage imageNamed:@"single_check"];
    }
    if ([self.weichatImageView.image isEqual:[UIImage imageNamed:@"single_check"]]) {
        self.weichatImageView.image = [UIImage imageNamed:@"single_checked"];
    }
    if (self.delegate && [self.delegate respondsToSelector:@selector(chooseTheType:)]) {
        [self.delegate chooseTheType:1];
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
